/*
 * explorer.h
 *
 *  Created on: Dec 23, 2010
 *      Author: cesar
 */

#ifndef EXPLORER_H
#define EXPLORER_H

#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../Util/util.h"
#define MALLOC_EST_FILES 100	//numero estimado de arquivos comuns de uma pasta
#define MALLOC_EST_FOLDER 100	//numero estimado de pastas dentro de uma pasta

typedef struct dirent *p_ent;

typedef struct st_folder *p_st_folder;

typedef struct st_folder {
	struct dirent *ent;
	int num_folders;
	int num_files;
	char *diff_folders;
	char *diff_files;
	p_st_folder *folders;
	p_ent *files;
} st_folder;

p_st_folder exploreFolder(char *dir_uri, p_ent ent);

p_st_folder initFolderSt(p_ent ent);

void printContent(p_st_folder folderSt, int level);

void freeContent(p_st_folder folderSt);

p_ent clone_ent(p_ent ent);

int diffFolder(p_st_folder folder1, p_st_folder folder2);

int diffFiles(p_ent file1, p_ent file2);

int compareFolder (const void * a, const void * b);

int compareFiles (const void * a, const void * b);

#endif
